package com.jichangxiu.server.platform.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import com.jichangxiu.common.entity.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("platform_dept")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "部门实体")
public class PlatformDept extends BaseEntity implements Serializable {

    @Schema(description = "部门ID")
    @TableId(value = "dept_id", type = IdType.ASSIGN_UUID)
    private String deptId;

    @TableField("dept_no")
    @Schema(description = "部门编号")
    private String deptNo;

    @TableField("dept_code")
    @Schema(description = "部门标识")
    private String deptCode;

    @TableField("dept_name")
    @Schema(description = "部门名称")
    private String deptName;

    @TableField("parent_id")
    @Schema(description = "父部门ID")
    private String parentId;

    @TableField("tenant_id")
    @Schema(description = "租户ID")
    private String tenantId;

    @TableField("leader_user_id")
    @Schema(description = "负责人ID")
    private String leaderUserId;

    @TableField("phone")
    @Schema(description = "部门联系电话")
    private String phone;

    @TableField("email")
    @Schema(description = "部门邮箱")
    private String email;

    @Schema(description = "排序")
    @TableField(value = "sort", keepGlobalFormat = true)
    private Double sort;

    @TableField("remark")
    @Schema(description = "备注")
    private String remark;

    @TableField("status")
    @Schema(description = "状态（false停用 true正常）")
    private Boolean status;

    @TableLogic
    @TableField("deleted")
    @Schema(description = "是否删除（0否 1是）")
    private String deleted;

    @TableField(exist = false)
    @Schema(description = "负责人名称")
    private String leaderUserName;

    @TableField(exist = false)
    @Schema(description = "部门下人员")
    private List<PlatformUser> platformUsers;

    @TableField(exist = false)
    @Schema(description = "部门下岗位")
    private List<PlatformPost> platformPosts;

    @TableField(exist = false)
    @Schema(description = "子部门")
    private List<PlatformDept> subPlatformDepts;

}
